﻿using System;

namespace Entities
{
    [Serializable]
    public class CoachType
    {
        private int coachTypeID;
        private string coachTypeName;
        private float ratioFare;
        public CoachType()
        { }
        public CoachType(int coachTypeID, string coachTypeName, float ratioFare)
        {
            this.coachTypeID = coachTypeID;
            this.coachTypeName = coachTypeName;
            this.ratioFare = ratioFare;
        }
        public int CoachTypeID
        {
            get { return this.coachTypeID; }
            set
            {
                if (value < 0)
                    throw new Exception("coachTypeID not allow nullvalue.");
                this.coachTypeID = value;
            }
        }
        public string CoachTypeName
        {
            get { return this.coachTypeName; }
            set { this.coachTypeName = value; }
        }
        public float RatioFare
        {
            get { return this.ratioFare; }
            set { this.ratioFare = value; }
        }
        public override string ToString()
        {
            return this.coachTypeID + "; " + this.coachTypeName + "; " + this.ratioFare + "; ";
        }
        public override bool Equals(Object obj)
        {
            CoachType me = (CoachType)obj;
            bool ret = this.CoachTypeID.Equals(me.CoachTypeID);
            return ret;
        }
        public override int GetHashCode()
        {
            return this.CoachTypeID.GetHashCode();
        }

    }
}